class BaiduLocation {

  getLocation() {
    return new Promise((resolve, reject) => {
      // const map = new BMap.Map("allmap", {enableMapClick: false});
      const geolocation = new BMap.Geolocation();
      geolocation.enableSDKLocation();
      geolocation.getCurrentPosition(function (r) {
        try {
          console.log("百度地图返回：", r);

          if (this.getStatus() == BMAP_STATUS_SUCCESS) {
            resolve({
              latitude: parseFloat(r.point.lat),
              longitude: parseFloat(r.point.lng),
            });
          }
        } catch (e) {
          reject(e);
        }

      }, {enableHighAccuracy: true});
    });
  }

  openLocation(lng, lat, name, address, callback) {
    //use callback
    callback();
  }
}

export default BaiduLocation;
